<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('车辆列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>车牌号：</label>
                            <input type="text" name="carno"/>
                        </li>
                        <li>
                            <label>车辆分类：</label>
                            <select name="vehiclecategory" th:with="type=${@dict.getType('vehicle_category')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>级别：</label>
                            <select name="level" th:with="type=${@dict.getType('vehicle_level')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>车牌颜色：</label>
                            <select name="platecolor" th:with="type=${@dict.getType('vehicle_platecolor')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>所属项目：</label>
                            <input type="text" name="projectname"/>
                        </li>
                        <li>
                            <label>使用者：</label>
                            <input type="text" name="users"/>
                        </li>

                        <li>
                            <label>所属公司：</label>
                            <input type="text" name="companyname"/>
                        </li>
                        <li>
                            <label>登记证号：</label>
                            <input type="text" name="registerno"/>
                        </li>
                        <li>
                            <label>排放标准：</label>
                            <select name="caremission" th:with="type=${@dict.getType('vehicle_emission')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>燃料：</label>
                            <select name="fuel" th:with="type=${@dict.getType('vehicle_fuel')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>

                        <li>
                            <label>车辆轴数：</label>
                            <input type="text" name="vehicleaxlecount"/>
                        </li>

                        <li>
                            <label>车辆品牌：</label>
                            <input type="text" name="vehiclebrand"/>
                        </li>

                        <li>
                            <label>生产厂家：</label>
                            <input type="text" name="vehicleproducer"/>
                        </li>
                        <li>
                            <label>车辆状态：</label>
                            <select name="status" th:with="type=${@dict.getType('vehicle_status')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
                                        th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li>
                            <label>年审月份：</label>
                            <select name="vehiclereviewmonth" class="form-control m-b" th:with="type=${@dict.getType('year_of_month')}">
                                <option value="">所有</option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label>购买日期：</label>
                            <input type="text" class="time-input" id="purchasestartTime" placeholder="购买日期"
                                   name="purchasedate"/>
                        </li>
                        <li class="select-time">
                            <label>报废日期：</label>
                            <input type="text" class="time-input" id="scrappingStartTime" placeholder="报废日期"
                                   name="vehiclescrappingdate"/>
                        </li>
                        <li class="select-time">
                            <label>租赁开始日：</label>
                            <input type="text" class="time-input" id="leaseStartStartTime" placeholder="租赁开始日期"
                                   name="vehicleleasestartdate"/>
                        </li>
                        <li class="select-time">
                            <label>租赁截止日：</label>
                            <input type="text" class="time-input" id="leaseEndStartTime" placeholder="租赁截止日期"
                                   name="vehicleleaseenddate"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:vehicle:add">
                <i class="fa fa-plus"></i> 添加
            </a>
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:vehicle:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:vehicle:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:vehicle:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:vehicle:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:vehicle:remove')}]];
    var prefix = ctx + "system/vehicle";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "车辆",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'uid',
                    title: 'uid',
                    visible: false
                },
                {
                    field: 'carno',
                    title: '车牌号',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var tmp=row.carno;
                        actions.push('<a class="btn btn-success btn-xs ' + '" href="javascript:void(0)" onclick="gotoMap(\'' + row.carno + '\')">'+tmp+'</a>');
                        return actions.join('');
                    }
                },
                {
                    field: 'users',
                    title: '使用者',
                    formatter: function(value, row, index) {
                        var actions = [];
                        var uName=row.users;
                        actions.push('<a class="btn btn-primary btn-xs ' + '" href="javascript:void(0)" onclick="gotoMaintence(\'' + row.carno +'\')">'+uName+'</a>');
                        return actions.join('');
                    }
                },
                {
                    field: 'vehiclecategory',
                    title: '车辆分类'
                },
                {
                    field: 'projectname',
                    title: '所属项目'
                },
                {
                    field: 'level',
                    title: '级别'
                },
                {
                    field: 'vinno',
                    title: '车架号'
                },
                {
                    field: 'enginesn',
                    title: '发动机号'
                },
                {
                    field: 'vehiclemodel',
                    title: '规格型号'
                },
                {
                    field: 'enginemodel',
                    title: '发动机型号'
                },
                {
                    field: 'companyname',
                    title: '所属公司'
                },
                {
                    field: 'registerno',
                    title: '登记证号'
                },
                {
                    field: 'purchasedate',
                    title: '车辆购买日期   '
                },
                {
                    field: 'purchasecost',
                    title: '购买车辆费用'
                },
                {
                    field: 'caremission',
                    title: '排放标准'
                },
                {
                    field: 'platecolor',
                    title: '车牌颜色'
                },
                {
                    field: 'fuel',
                    title: '燃料'
                },
                {
                    field: 'tyrecount',
                    title: '轮胎数量'
                },
                {
                    field: 'tyretype',
                    title: '轮胎规格'
                },
                {
                    field: 'carcolor',
                    title: '车身颜色'
                },
                {
                    field: 'vehicleaxlecount',
                    title: '车辆轴数'
                },
                {
                    field: 'vehiclelength',
                    title: '车辆长度cm'
                },
                {
                    field: 'vehiclewidth',
                    title: '车辆宽度cm'
                },
                {
                    field: 'vehicleweight',
                    title: '车辆重量kg'
                },
                {
                    field: 'vehicledeadweight',
                    title: '核载重量kg'
                },
                {
                    field: 'vehiclepassengercount',
                    title: '载客人数'
                },
                {
                    field: 'vehiclelicense',
                    title: '行驶证编号'
                },
                {
                    field: 'vehiclebrand',
                    title: '车辆品牌'
                },
                {
                    field: 'vehiclewheelbase',
                    title: '车辆轴距'
                },
                {
                    field: 'vehicleproducer',
                    title: '生产厂家'
                },
                {
                    field: 'vehiclescrappingdate',
                    title: '车辆报废日期   '
                },
                {
                    field: 'vehiclereviewmonth',
                    title: '年审月份'
                },
                {
                    field: 'vehicleleasestartdate',
                    title: '租赁开始日期   '
                },
                {
                    field: 'vehicleleaseenddate',
                    title: '租赁截止日期   '
                },
                {
                    field: 'deposit',
                    title: '押金|转让金'
                },
                {
                    field: 'monthrent',
                    title: '每月租金'
                },

                {
                    field: 'status',
                    title: '车辆状态'
                },
                {
                    field: 'mileage',
                    title: '已行驶公里数km'
                },
                {
                    field: 'remarks',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')" style="padding:4px; margin:4px"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-primary  btn-xs" href="javascript:void(0)" onclick="gotoMaintence(\'' + row.carno + '\')"><i class="fa fa-search"></i>查看维保记录</a>');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')" style="padding:4px; margin:4px"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function gotoMap(carno) {
        var url = prefix + '/gotobdmap/bdmap?carno='+carno;
        $.modal.open("车辆实时位置3D视图", url, '800', '600');
    }

    function gotoMaintence(carno){
        var url = ctx + 'system/maintenance/justlist?id='+carno;
        $.modal.open("车辆维保记录", url, '1080', '700');
    }
</script>
</body>
</html>
